package com.ykh.mybbsdemo.utils;

import com.ykh.mybbsdemo.dao.pojo.SysUser;

//本地线程, 用于在 corntroller中直接获取用户信息
public class UserThreadLocal {
    //设置为单例
    private UserThreadLocal(){}

    private static final ThreadLocal<SysUser> LOCAL = new ThreadLocal<>();

    public static void put(SysUser sysUser){
        LOCAL.set(sysUser);
    }
    public static SysUser get(){
        return LOCAL.get();
    }
    public static void remove(){
        LOCAL.remove();
    }
}